package Code;

import java.io.File;
import java.util.Scanner;

public class QuestionNum_22_3_hxj {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要删除的文件夹路径：");
        String s = sc.nextLine();
        File file = new File(s);
        deleteDir(file);
    }

    private static void deleteDir(File file) {
        File[] files = file.listFiles();
        for (File f : files) {
//            System.out.println(f);
            if (f.isFile()){
                f.delete();
            }else{
                deleteDir(f);
            }
        }
        file.delete();
    }
}
